package com.pink.utils;

/**
 * @author: Mr.Pink
 * @date: 2022-06-07 22:41
 * @description: 时间格式化工具类
 * @create: 2022-06-07 22:41
 **/
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtil {

    public static String format(Date date, String pattern) {
        if (date == null || pattern == null) {
            return null;
        }
        try {
            SimpleDateFormat sdf = new SimpleDateFormat(pattern);
            return sdf.format(date);
        } catch (Exception e) {
            return null;
        }
    }
}
